<template>
  <div class="user">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="活动列表" name="first">
          <el-row style="padding:10px 0">
            <el-col :span="24">
              <!-- 给组件绑定原生事件的话，需要一个.native的修饰符 -->
              <el-input placeholder="请输入内容" class="search-input" v-model="activityTitle" @keydown.native.enter="initList">
                <el-button slot="append" icon="el-icon-search" @click="initList"></el-button>
              </el-input>
              <el-button type="success" plain @click="addDialogFormVisible=true">添加活动</el-button>
            </el-col>
          </el-row>
          <el-table class="margin-20" v-loading="loading" :data="newsList" border style="width: 100%">
            <el-table-column type="index" width="50">
            </el-table-column>
            <el-table-column prop="activityTitle" label="新闻标题">
            </el-table-column>
            <el-table-column prop="activityTime" label="活动开始时间" >
            </el-table-column>
            <el-table-column prop="address" label="活动地址" >
            </el-table-column>
            <el-table-column prop="sponsor" label="主办单位" >
            </el-table-column>
            <el-table-column prop="mainBody" label="活动介绍"  show-overflow-tooltip>
            </el-table-column>
            <el-table-column label="活动文档">   
              <template slot-scope="scope" >
                <div style="color:#4F94CD; cursor: pointer;" @click="wendang(scope.row)">{{ scope.row.url }}</div>
              </template>
            </el-table-column>
            <el-table-column label="操作" width="125">
              <template slot-scope="scope">
                <el-button size="mini" type="primary" plain icon="el-icon-edit" @click="showEditDialog(scope.row)">
                </el-button>
                <el-button size="mini" type="danger" plain icon="el-icon-delete" @click="showDeleteDialog(scope.row)">
                </el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="page">
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="1"
              :page-sizes="[10, 20, 30, 40]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper" :total="total">
            </el-pagination>
          </div>
          <!-- 添加用户对话框 -->
          <el-dialog title="添加活动" :visible.sync="addDialogFormVisible" width="70%">
            <el-form :model="addForm" label-width="120px" :rules="rules" ref="addUserForm">
              <el-form-item label="新闻标题:" prop="activityTitle" >
                <el-input v-model="addForm.activityTitle" auto-complete="off" ></el-input>
              </el-form-item>
              <el-form-item label="报名截至时间:">
                <el-date-picker
                    v-model="value1"
                    type="daterange"
                    unlink-panels
                    format="yyyy-MM-dd"
                    value-format="yyyy-MM-dd"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="活动开始时间:">
                <el-date-picker
                  v-model="value2"
                  type="date"
                  placeholder="活动开始时间"
                  style="width:150px">
                </el-date-picker>
                <el-time-select
                  style="width:120px"
                  placeholder="起始时间"
                  v-model="startTime"
                  :picker-options="{
                    start: '06:30',
                    step: '00:15',
                    end: '23:30'
                  }">
                </el-time-select>
                <el-time-select
                  style="width:120px"
                  placeholder="结束时间"
                  v-model="endTime"
                  :picker-options="{
                    start: '06:30',
                    step: '00:15',
                    end: '23:30',
                    minTime: startTime
                  }">
                </el-time-select>
              </el-form-item>
              <el-form-item label="活动地址:" prop="address" >
                <el-input v-model="addForm.address" auto-complete="off" ></el-input>
              </el-form-item>
              <el-form-item label="主办单位:" prop="sponsor" >
                <el-input v-model="addForm.sponsor" auto-complete="off" ></el-input>
              </el-form-item>
              <el-form-item label="活动介绍:" prop="mainBody" >
                <el-input v-model="addForm.mainBody" auto-complete="off" ></el-input>
              </el-form-item>
              <!-- <el-form-item label="活动文档名称:" prop="url" >
                <el-input v-model="addForm.url" auto-complete="off" ></el-input>
              </el-form-item> -->
              <el-form-item label="上传文档:" prop="targetName">
                <el-upload
                  class="avatar-uploader"
                  action="https://leather.ztazy.cn:3031/sys/file/file" 
                  :headers="headers"
                  :show-file-list="false"
                  :on-success="handleAvatarSuccess"
                  :before-upload="beforeAvatarUpload">
                  <!-- <img v-if="imageUrl" :src="imageUrl" class="avatar"> -->
                  <el-button slot="trigger">选取文件</el-button>
                  <div style="color:#4F94CD;display:inline-block;cursor:pointer" v-if="imageUrl" slot="tip" @click="myClick">{{addForm.url}}</div>
                  <div  style="display:inline-block" v-else slot="tip"></div>
                </el-upload>
              </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
              <el-button @click="addDialogFormVisible = false">取 消</el-button>
              <el-button type="primary" @click="addUserSubmit('addUserForm')">确 定</el-button>
            </div>
          </el-dialog>
          <!-- 编辑用户对话框 -->
          <el-dialog title="编辑活动" :visible.sync="editDialogFormVisible">
            <el-form :model="editForm" label-width="120px" :rules="rules" ref="editUserForm">
              <el-form-item label="新闻标题:" prop="activityTitle" >
                <el-input v-model="editForm.activityTitle" auto-complete="off" ></el-input>
              </el-form-item>
              <el-form-item label="报名截至时间:">
                <el-date-picker
                    v-model="editvalue1"
                    type="daterange"
                    unlink-panels
                    format="yyyy-MM-dd"
                    value-format="yyyy-MM-dd"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="活动开始时间:">
                <el-date-picker
                  style="width:150px"
                  v-model="editvalue2"
                  type="date"
                  placeholder="活动开始时间">
                </el-date-picker>
                <el-time-select
                  style="width:120px"
                  placeholder="起始时间"
                  v-model="editstartTime"
                  :picker-options="{
                    start: '06:30',
                    step: '00:15',
                    end: '23:30'
                  }">
                </el-time-select>
                <el-time-select
                  style="width:120px"
                  placeholder="结束时间"
                  v-model="editendTime"
                  :picker-options="{
                    start: '06:30',
                    step: '00:15',
                    end: '23:30',
                    minTime: startTime
                  }">
                </el-time-select>
              </el-form-item>
              <el-form-item label="活动地址:" prop="address" >
                <el-input v-model="editForm.address" auto-complete="off" ></el-input>
              </el-form-item>
              <el-form-item label="主办单位:" prop="sponsor" >
                <el-input v-model="editForm.sponsor" auto-complete="off" ></el-input>
              </el-form-item>
              <el-form-item label="活动介绍:" prop="mainBody" >
                <el-input v-model="editForm.mainBody" auto-complete="off" ></el-input>
              </el-form-item>
              <el-form-item label="上传文档:" prop="targetName">
                <el-upload
                  class="avatar-uploader"
                  action="https://leather.ztazy.cn:3031/sys/file/file" 
                  :headers="headers"
                  :show-file-list="false"
                  :on-success="edithandleAvatarSuccess"
                  :before-upload="editbeforeAvatarUpload">
                  <!-- <img v-if="imageUrl" :src="imageUrl" class="avatar"> -->
                  <el-button slot="trigger">选取文件</el-button>
                  <div style="color:#4F94CD;display:inline-block;cursor:pointer" v-if="editForm.url" slot="tip" @click="myeditClick">{{editForm.url}}</div>
                  <div  style="display:inline-block" v-else slot="tip"></div>
                </el-upload>
              </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
              <el-button @click="editDialogFormVisible = false">取 消</el-button>
              <el-button type="primary" @click="editUserSubmit('editUserForm')">确 定</el-button>
            </div>
          </el-dialog>
      </el-tab-pane>
      <el-tab-pane label="活动申请列表" name="second">
          <!-- <el-row style="padding:10px 0">
            <el-col :span="24">
              给组件绑定原生事件的话，需要一个.native的修饰符
              <el-input placeholder="请输入内容" class="search-input" v-model="companyName" @keydown.native.enter="initList">
                <el-button slot="append" icon="el-icon-search" @click="initList"></el-button>
              </el-input>
            </el-col>
          </el-row> -->
          <el-table class="margin-20" v-loading="loading" :data="activity_applylist" border style="width: 100%">
            <el-table-column type="index" width="50">
            </el-table-column>
            <el-table-column prop="title" label="政策名称">
            </el-table-column>
            <el-table-column prop="companyName" label="企业名称">
            </el-table-column>
            <el-table-column prop="name" label="企业负责人">
            </el-table-column>
            <el-table-column prop="phone" label="联系电话">
            </el-table-column>
            <el-table-column prop="createDate" label="创建时间">
            </el-table-column>
            <el-table-column label="操作" width="70">
              <template slot-scope="scope">
                <!-- <el-button size="mini" type="primary" plain icon="el-icon-edit" @click="showEditDialog(scope.row)">
                </el-button> -->
                <el-button size="mini" type="danger" plain icon="el-icon-delete" @click="applylistDeleteDialog(scope.row)">
                </el-button>
                <!-- <el-button size="mini" type="warning" plain icon="el-icon-check" @click="showGrantDialog(scope.row)">
                </el-button> -->
              </template>
            </el-table-column>
          </el-table>
          <div class="page">
            <el-pagination @size-change="activityhandleSizeChange" @current-change="activityhandleCurrentChange" :current-page="1"
              :page-sizes="[10, 20, 30, 40]" :page-size="activitypagesize" layout="total, sizes, prev, pager, next, jumper" :total="activity_applytotal">
            </el-pagination>
          </div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import VueUeditorWrap from '../../components/vue-ueditor-wrap.vue';
  import {
    activityList,
    addactivity,
    editactivity,
    deleteactivity,
    PHPURL,
    activity_applylist,
    deleteactivity_apply,

  } from '@/api'
  export default {
      components: {
    VueUeditorWrap
  },
    data() {
      return {
        activeName: 'first',
        startTime: '',
        endTime: '',
        value1:"",
        value2:"",
          msg: '',
        myConfig: {
          autoHeightEnabled: false,
          initialFrameHeight: 300,
          initialFrameWidth: '100%',
          UEDITOR_HOME_URL: '/static/UEditor/',
          serverUrl: PHPURL
        },
        companyName:'',
        imageUrl: '',
        fileList: [],
        newsList: [],
        activity_applylist:[],
        activity_applytotal:0,
        total: 0,
        targetName:"",
        pagesize: 10,
        activityTitle:"",
        pagenum: 1,
        activitypagesize: 10,
        activitypagenum: 1,
        activity_applytotal:0,
        addDialogFormVisible: false,
        addForm: {
          activityTitle: '',
          targetName:'',
          url:"",
          mainBody:'',
          address:'',
          sponsor:'',
          appointmentTime:"",
          endTime:"",
          activityTime:'',
          activitySava:''
        },
        editvalue1:[],
        editvalue2:[],
        editstartTime: '',
        editendTime: '',
        editDialogFormVisible: false,
        editFormvlaue1:[],
        editForm: {
          activityTitle: '',
          targetName:'',
          url:"",
          mainBody:'',
          address:'',
          sponsor:'',
          createTime:"",
          appointmentTime:"",
          endTime:"",
          activityId:'',
          activityTime:'',
          activitySava:''
        },
        grantDialogFormVisible: false,
        grantForm: {},
        roleList: [],
        roleId: '',
        // 添加用户的表单验证
        rules: {
          username: [{
            required: true,
            message: '请输入用户名',
            trigger: 'blur'
          }],
          password: [{
            required: true,
            message: '请输入密码',
            trigger: 'blur'
          }],
          enterpriseName: [{
            required: true,
            message: '请输入企业名称',
            trigger: 'blur'
          }]
        }
      }
    },
    created() {
      this.initList()
    },
    computed: {
      headers() {
        return{
          "authorization": localStorage.getItem('mytoken') // 直接从本地获取token就行
        }
      }
    },
    methods: {
      editdateChangebirthday1(val){
      this.editForm.createTime = val[0]
      this.editForm.appointmentTime = val[1]
      },
      editdateChangebirthday2(val){
        this.editForm.endTime = val
      },
      dateChangebirthday1(val) {
      this.addForm.createTime = val[0]
      this.addForm.appointmentTime = val[1]
    },
      dateChangebirthday2(val) {
      this.addForm.endTime = val
    },
      handleAvatarSuccess(res, file) {
        console.log(res)
        console.log(file)
        this.imageUrl = URL.createObjectURL(file.raw);
        this.addForm.targetName = res.data.targetName
        console.log(this.addForm.targetName)
      },
      edithandleAvatarSuccess(res, file) {
        console.log(res)
        console.log(file)
        this.imageUrl = URL.createObjectURL(file.raw);
        this.editForm.targetName = res.data.targetName
      },
      beforeAvatarUpload(file) {
        console.log(file)
        this.addForm.url = file.name
        // const isJPG = file.type === 'image/jpeg';
        const isLt2M = file.size / 1024 / 1024 < 2;
        // if (!isJPG) {
        //   this.$message.error('上传头像图片只能是 JPG 格式!');
        // }
        if (!isLt2M) {
          this.$message.error('上传头像文件大小不能超过 2MB!');
        }
        return isLt2M;
      },
      editbeforeAvatarUpload(file){
        console.log(file)
        this.editForm.url = file.name
        // const isJPG = file.type === 'image/jpeg';
        const isLt2M = file.size / 1024 / 1024 < 2;
        // if (!isJPG) {
        //   this.$message.error('上传头像图片只能是 JPG 格式!');
        // }
        if (!isLt2M) {
          this.$message.error('上传头像文件大小不能超过 2MB!');
        }
        return isLt2M;
      },
        // 添加自定义按钮
    addCustomButtom (editorId) {
      window.UE.registerUI('test-button', function (editor, uiName) {
        // 注册按钮执行时的 command 命令，使用命令默认就会带有回退操作
        editor.registerCommand(uiName, {
          execCommand: function () {
            editor.execCommand('inserthtml', `<span>这是一段由自定义按钮添加的文字</span>`);
          }
        });
        // 创建一个 button
        var btn = new window.UE.ui.Button({
          // 按钮的名字
          name: uiName,
          // 提示
          title: '鼠标悬停时的提示文字',
          // 需要添加的额外样式，可指定 icon 图标，图标路径参考常见问题 2
          cssRules: "background-image: url('/test-button.png') !important;background-size: cover;",
          // 点击时执行的命令
          onclick: function () {
            // 这里可以不用执行命令，做你自己的操作也可
            editor.execCommand(uiName);
          }
        });
        // 当点到编辑内容上时，按钮要做的状态反射
        editor.addListener('selectionchange', function () {
          var state = editor.queryCommandState(uiName);
          if (state === -1) {
            btn.setDisabled(true);
            btn.setChecked(false);
          } else {
            btn.setDisabled(false);
            btn.setChecked(state);
          }
        });
        // 因为你是添加 button，所以需要返回这个 button
        return btn;
      }, 0 /* 指定添加到工具栏上的哪个位置，默认时追加到最后 */, editorId /* 指定这个 UI 是哪个编辑器实例上的，默认是页面上所有的编辑器都会添加这个按钮 */);
    },
    // 添加自定义弹窗
    addCustomDialog (editorId) {
      window.UE.registerUI('test-dialog', function (editor, uiName) {
        // 创建 dialog
        var dialog = new window.UE.ui.Dialog({
          // 指定弹出层中页面的路径，这里只能支持页面，路径参考常见问题 2
          iframeUrl: '/customizeDialogPage.html',
          // 需要指定当前的编辑器实例
          editor: editor,
          // 指定 dialog 的名字
          name: uiName,
          // dialog 的标题
          title: '这是一个自定义的 Dialog 浮层',
          // 指定 dialog 的外围样式
          cssRules: 'width:600px;height:300px;',
          // 如果给出了 buttons 就代表 dialog 有确定和取消
          buttons: [
            {
              className: 'edui-okbutton',
              label: '确定',
              onclick: function () {
                dialog.close(true);
              }
            },
            {
              className: 'edui-cancelbutton',
              label: '取消',
              onclick: function () {
                dialog.close(false);
              }
            }
          ]
        });
        // 参考上面的自定义按钮
        var btn = new window.UE.ui.Button({
          name: 'dialog-button',
          title: '鼠标悬停时的提示文字',
          cssRules: `background-image: url('/test-dialog.png') !important;background-size: cover;`,
          onclick: function () {
            // 渲染dialog
            dialog.render();
            dialog.open();
          }
        });
        return btn;
      }, 0 /* 指定添加到工具栏上的那个位置，默认时追加到最后 */, editorId /* 指定这个UI是哪个编辑器实例上的，默认是页面上所有的编辑器都会添加这个按钮 */);
    },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`)
        this.pagesize = val
        this.initList()
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`)
        this.pagenum = val
        this.initList()
      },
      activityhandleSizeChange(val) {
        console.log(`每页 ${val} 条`)
        this.activitypagesize = val
        this.initList()
      },
      activityhandleCurrentChange(val) {
        console.log(`当前页: ${val}`)
        this.activitypagenum = val
        this.initList()
      },
      initList() {
        this.loading = true
        activityList({
          params: {
            activityTitle:this.activityTitle,
            page: this.pagenum-1,
            size : this.pagesize,
            sortField: 'createTime',
            sortType:'desc'
          }
        }).then(res => {
          this.newsList = res.data.content
          this.total = res.data.totalElements
          this.loading = false
        })
        activity_applylist({
          params: {
            companyName:this.companyName,
            page: this.pagenum-1,
            size : this.pagesize,
            sortField: 'createTime',
            sortType:'desc'
          }
        }).then(res => {
          console.log(res)
          this.activity_applylist = res.data.content
          this.activity_applytotal = res.data.totalElements
        })
      },
      handleClick(tab, event) {
        if(tab.name=='second'){
          console.log(123)
        }
      },
      // closeDiaglog(){
      //   this.$refs['addUserForm'].resetFields()
      // },
      // 添加用户
      addUserSubmit(formName) {
        if(this.value2==''||this.startTime==''||this.endTime==''){
           return this.$message({
              type: 'warning',
              message: '时间不能为空'
            })
        }
        var timestamp = parseInt(new Date(this.value2).getTime()/1000); 
        var date = new Date(timestamp * 1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
         var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1);
          var D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) ;
        var ji = "日一二三四五六".charAt(new Date(this.value2).getDay())
        var activityTime = M+'月'+D+'日'+"(周"+ji+') '+this.startTime+'~'+this.endTime
        this.addForm.activitySava=timestamp
        this.addForm.activityTime=activityTime
        this.addForm.appointmentTime=this.value1[0]
        this.addForm.endTime=this.value1[1]
         this.$refs[formName].validate(valide => {
          if (valide) {
            addactivity(this.addForm).then(res => {
              if (res.status === 0) {
                this.$message({
                  type: 'success',
                  message: '创建用户成功'
                })
              this.initList()
              } else {
                this.$message({
                  type: 'warning',
                  message: res.message
                })
              }
              this.addDialogFormVisible = false
            })
          } 
        })
      },
      // 显示编辑用户对话框
      showEditDialog(row) {
        this.editvalue1=[]
        this.editDialogFormVisible= true
        this.editForm.activityTitle = row.activityTitle
        this.editForm.address = row.address
        this.editForm.sponsor = row.sponsor
        this.editForm.mainBody = row.mainBody
        this.editForm.endTime = row.endTime
        this.editForm.appointmentTime = row.appointmentTime
        this.editForm.createTime = row.createTime
        this.editForm.targetName = row.targetName
        this.editForm.url = row.url
        this.editForm.activityId = row.activityId
        this.editvalue1.push(row.appointmentTime,row.endTime)
        var arr=row.activityTime.split(" ");
        this.editvalue2 = new Date(row.activitySava*1000);
        var ard = arr[1].split("~");
        this.editstartTime = ard[0]
        this.editendTime = ard[1]
      },
      wendang(row){
        window.location.href = 'https://wisdom-city.oss-cn-hangzhou.aliyuncs.com/'+row.targetName
      },
      // 编辑用户提交
      editUserSubmit(formName) {
        if(this.editvalue2==''||this.editstartTime==''||this.editendTime==''){
           return this.$message({
              type: 'warning',
              message: '时间不能为空'
            })
        }
        var timestamp = parseInt(new Date(this.editvalue2).getTime()/1000); 
        var date = new Date(timestamp * 1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
         var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1);
          var D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) ;
        var ji = "日一二三四五六".charAt(new Date(this.editvalue2).getDay())
        var activityTime = M+'月'+D+'日'+"(周"+ji+') '+this.editstartTime+'~'+this.editendTime
        this.editForm.activitySava=timestamp
        this.editForm.activityTime=activityTime
        this.editForm.appointmentTime=this.editvalue1[0]
        this.editForm.endTime=this.editvalue1[1]
        this.$refs[formName].validate(valide => {
          if (valide) {
            editactivity(this.editForm).then(res => {
              if (res.status === 0) {
                this.$message({
                  type: 'success',
                  message: '编辑成功'
                })
                this.editDialogFormVisible = false
                this.initList()
              } else {
                this.$message({
                  type: 'warning',
                  message: res.message
                })
              }
            })
          }
        })
      },
      myClick(){
        console.log(this.addForm.targetName)
         window.location.href = 'https://wisdom-city.oss-cn-hangzhou.aliyuncs.com/'+this.addForm.targetName
      },
      myeditClick(){
        window.location.href = 'https://wisdom-city.oss-cn-hangzhou.aliyuncs.com/'+this.editForm.targetName
      },
      // 显示删除对话框
      applylistDeleteDialog(row){
        console.log(row)
        this.$confirm('此操作将永久删除该用户, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          // 执行删除用户操作
          deleteactivity_apply({
          params: {
            activityApplyId:row.activityApplyId
          }
        }).then(res => {
            if (res.status === 0) {
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
              this.initList()
            } else {
              this.$message({
                type: 'warning',
                message: res.message
              })
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
        })
      },
      // 显示删除对话框
      showDeleteDialog(row) {
        console.log(row)
        this.$confirm('此操作将永久删除该用户, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          // 执行删除用户操作
          deleteactivity({
          params: {
            activityId:row.activityId
          }
        }).then(res => {
            if (res.status === 0) {
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
              this.initList()
            } else {
              this.$message({
                type: 'warning',
                message: res.message
              })
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
        })
      },
    }
  }

</script>
<style lang="scss" scoped>
  .user {
    .margin-20 {
      margin: 20px 0;
    }
    .el-form-item__content{
    width: 80%;
}
    .preview{
    min-height: 300px;
    width: 100%;
    }
    .search-input {
      width: 300px;
    }
    .page {
      padding: 5px 0;
      background-color: #D3DCE6;
    }
  }
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }

</style>
